<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>标题</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<form class="layui-form searchForm">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label" style="width: 100px;">企业名称：</label>
            <div class="layui-input-inline">
                <input type="text" name="orgName" id="orgName" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-inline">
            <div class="layui-input-inline">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="formDemo">搜索</button>
            </div>
        </div>
    </div>
</form>
<table class="layui-hide" id="dataList" lay-filter="dataList"></table>
<script type="text/html" id="toolbarOrg">

</script>

<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-sm layui-btn-xs" lay-event="save">设置同体回避</a>
</script>

<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    var configureCom = {};
    layui.use(['jquery', 'configureCom', 'configure', 'sessionFun', 'table'], function () {
        var $ = layui.jquery;
        var configure = layui.configure;
        var table = layui.table;
        var sessionFun = layui.sessionFun;
        var matchDict=layui.matchDict;
        var configureCom = layui.configureCom;
        var cols = [[
            {field: 'orgNo', title: '企业ID',width:'80'},
            {field: 'creditCode', title: '统一社会信用代码',width:'180'},
            {field: 'orgName', title: '企业/机构名称',width:'250'},
            {field: 'status', title: '机构状态',width:'130',templet: function (d) {
                    return matchDict.name(d.status, configure.ORG_STATUS);
            }},
            {field: 'orgTypeName', title: '企业类型',width:'120'},
            {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 100}
        ]];
        configureCom.tableRender(configure.KANSHE_COMPANY_LIST_HTTP, {}, cols, 'dataList', 10, 'full', 'toolbarOrg');
        configureCom.tableSearch();
        //头工具栏事件
        table.on('toolbar(dataList)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
            sessionFun.remove(configure.SESSION_LIST_DATA);
            switch (obj.event) {
            }
        });


        //每行操作
        table.on('tool(dataList)', function (obj) {
            var data = obj.data;
            sessionFun.set(configure.SESSION_LIST_DATA, data);
            if (obj.event ==='save') {//查看详情
                saveFun(data.orgNo);

            }
        });

        function saveFun(orgNO){
            var data={};
            data['drawingUnit']=localStorage.DrawingUnit;
            data['designUnit']=orgNO;
            configureCom.postDataAjax(configure.SAVE_PRJ_EXAMINE_AVOID_HTTP, data).then(function (res) {
                if (res.code == 0) {
                    top.layer.msg('恭喜您，设置成功！');
                } else {
                    top.layer.alert('设置失败，请重试！');
                }
            });
        }
    });

</script>
</body>
</html>